package com.itheima.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 评论实体
 *
 * @author 51585
 * @TableName comment
 */
@TableName(value = "comment")
@Data
@ApiModel(value = "评论实体")
public class Comment implements Serializable {
    private static final long serialVersionUID = -3769730123859184444L;
    /**
     * 评论id
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 信息id
     */
    @ApiModelProperty(value = "评论对应的信息id", required = true)
    @TableField(value = "message_id")
    private Integer messageId;

    /**
     * 评论的内容
     */
    @ApiModelProperty(value = "评论的内容", required = true)
    @TableField(value = "content")
    private String content;

    /**
     * 发布评论时间
     */
    @ApiModelProperty(value = "评论的时间")
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    /**
     * 父级评论，0为第一条评论
     */
    @ApiModelProperty(value = "当前评论的父级评论，为0则是对信息的评论")
    @TableField(value = "parent_comment_id")
    private Integer parentCommentId;

    /**
     * 评论者的id
     */
    @ApiModelProperty(value = "评论者的id")
    @TableField(value = "user_id")
    private String userId;

    /**
     * 是不是叶子评论
     */
    @ApiModelProperty(value = "叶子评论标识")
    @TableField(value = "is_child")
    private Integer isChild;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @TableField(value = "updated_at", fill = FieldFill.UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;

    /**
     * 删除时间
     */
    @ApiModelProperty(value = "删除时间")
    @TableField(value = "deleted_at")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableLogic
    private LocalDateTime deletedAt;

}
